<script>
    window.ccMixIn = window.ccMixIn || {}
    window.ccMixIn.fixHeight = {
        methods: {
            fixHeight() {
                if (window.parent) {
                    Object.assign(this.$el.style, {
                        "overflow-y": "auto",
                        "padding-bottom": "40px",
                        "box-sizing": "border-box"
                    })
                    const setHeight = function () {
                        if (window.parent && window.parent.frameElement) {
                            const height = Math.min(window.parent.frameElement.clientHeight,
                                    window.frameElement.parentNode.clientHeight)
                            this.$el.style.height = height + "px"
                        }
                    }.bind(this);
                    window.parent.addEventListener("resize", setHeight);
                    window.addEventListener("beforeunload", function () {
                        window.parent.removeEventListener("resize", setHeight);
                    });
                    setHeight()
                }
            },
            handleScroll(top) {
                this.$el.scrollBy({
                    top: top,
                    left: 0,
                    behavior: 'smooth'
                });
            }
        },
        mounted() {
            this.fixHeight()
        }
    }
</script>